project(mpc)

cmake_minimum_required (VERSION 3.5)

# -g allows for gdb debugging
# turn on -03 for best performance
add_definitions(-std=c++11)

set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "${CXX_FLAGS}")

set(sources src/MPC.cpp src/main.cpp src/matplotlibcpp.h)

#include_directories(src/Eigen-3.3)
find_package(Eigen3)
if (${EIGEN3_FOUND})
  include_directories(${EIGEN3_INCLUDE_DIR})
  message(STATUS, "Eigen3 path: ${EIGEN3_INCLUDE_DIR}")
else()
  message(STATUS "Eigen3 not found")
endif()

find_package(Python3 COMPONENTS Interpreter Development)
if (${Python3_FOUND})
  include_directories(${Python3_INCLUDE_DIRS})
  message(STATUS, "Python3 path: ${Python3_INCLUDE_DIRS}")
else()
  message(FATAL_ERROR "Python3 not found, please install it.")
endif()

#find_package(NumPy)
set(Python3_NumPy_INCLUDE_DIRS "/usr/include/python3.10/numpy")
include_directories(${Python3_NumPy_INCLUDE_DIRS})
#find_package(Python3 COMPONENTS NumPy)
#if (${PYTHON_NUMPY_FOUND})
#  include_directories(${PYTHON_NUMPY_INCLUDE_DIR})
#  message(STATUS, "Python_Numpy path: ${PYTHON_NUMPY_INCLUDE_DIR}")
#else()
#  message(WARNING "Python3 NumPy not found, proceeding with -DWITHOUT_NUMPY."
#  " Some functions might not work.")
#  add_definitions(-DWITHOUT_NUMPY)
#endif()

include_directories(/usr/local/include)
link_directories(/usr/local/lib)

add_executable(mpc ${sources})
target_link_libraries(mpc ipopt ${Python3_LIBRARIES})

#if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
#target_link_libraries(mpc ipopt python2.7)
#else()
#target_link_libraries(mpc ipopt python)
#endif()

